package com.ruoyi.walmart.service.shipments.impl;

import com.ruoyi.walmart.domain.shipments.Shipment;
import com.ruoyi.walmart.mapper.shipments.ShipmentMapper;
import com.ruoyi.walmart.service.shipments.ShipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShipmentServiceImpl implements ShipmentService {

    @Autowired
    ShipmentMapper shipmentMapper;

    @Override
    public List<Shipment> selectShipmentByAuthId(Long authId) {
        return shipmentMapper.selectShipmentByAuthId(authId);
    }

    @Override
    public int shipmentInsertList(List<Shipment> shipmentList) {
        return shipmentMapper.shipmentInsertList(shipmentList);
    }

    @Override
    public int deleteShipmentByAuthId(Long authId) {
        return shipmentMapper.deleteShipmentByAuthId(authId);
    }

    @Override
    public List<Shipment> selectList(Shipment shipment) {
        return shipmentMapper.selectList(shipment);
    }

    @Override
    public int countByStatus(Shipment shipment) {
        return shipmentMapper.countByStatus(shipment);
    }

    @Override
    public int updateStatus(Shipment shipment) {
        return shipmentMapper.updateStatus(shipment);
    }

    @Override
    public Shipment selectShipment(Shipment shipment) {
        return shipmentMapper.selectShipment(shipment);
    }
    /**
     * 查询已取消状态的 shipment_id 列表
     * @param shipmentIds
     * @return
     */
    @Override
    public List<String> selectCancelledShipmentIds(List<String> shipmentIds) {
        return shipmentMapper.selectCancelledShipmentIds(shipmentIds);
    }
    // 根据shipmentId列表删除Shipment
    @Override
    public void deleteShipmentsByIds(List<String> shipmentIds) {
        if (shipmentIds != null && !shipmentIds.isEmpty()) {
            shipmentMapper.deleteShipmentsByIds(shipmentIds);
        }
    }
}
